package com.burstly.lib.component.activitylauncher;

import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import com.burstly.lib.util.LoggerExt;

public class ActivtyLauncher
{
  private static final LoggerExt LOG = LoggerExt.getInstance();
  private static final String TAG = ActivtyLauncher.class.getSimpleName();
  private final IActivityLauncherSource mCondition;
  private final Context mContext;
  private String mNetworkName;
  private String mTag;

  public ActivtyLauncher(IActivityLauncherSource paramIActivityLauncherSource, Context paramContext)
  {
    this.mCondition = paramIActivityLauncherSource;
    this.mContext = paramContext;
    this.mTag = TAG;
  }

  public String getNetworkName()
  {
    return this.mNetworkName;
  }

  public void launchActivity()
  {
    if ((this.mContext != null) && (this.mCondition != null))
    {
      if (!this.mCondition.isAllowedToLaunch())
      {
        this.mCondition.onFailToLaunch("Launch isn`t allowed. Basically this means that interstitial of the same type is showing now.");
        return;
      }
      Intent localIntent = this.mCondition.getIntent();
      if (localIntent != null)
        localIntent.putExtra("networkName", this.mNetworkName);
      try
      {
        this.mCondition.beforeLaunch();
        this.mContext.startActivity(localIntent);
        this.mCondition.onSuccesToLaunch();
        return;
      }
      catch (ActivityNotFoundException localActivityNotFoundException)
      {
        String str = localIntent.getComponent().getClassName();
        LOG.logError(this.mTag, "Cannot load Burstly interstitial. Did you add {0} activity to your manifest file?", new Object[] { str });
        this.mCondition.onActivityNotFound(str);
        return;
      }
    }
    LOG.logError(this.mTag, "Context or Condition is null!", new Object[0]);
    this.mCondition.onFailToLaunch("Context or Condition is null!");
  }

  public ActivtyLauncher setNetworkName(String paramString)
  {
    this.mNetworkName = paramString;
    return this;
  }

  public ActivtyLauncher setTag(String paramString)
  {
    this.mTag = paramString;
    return this;
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.activitylauncher.ActivtyLauncher
 * JD-Core Version:    0.6.2
 */